cmake_minimum_required(VERSION 2.6)
project(Shared)

include_directories(
    ${PROJECT_SOURCE_DIR}/../
)

set(Shared_SRC
    Global_Macros.h
    Exception.h
    Exception.cc
    Common.h
    Common.cc
    OpcodeDefine.h
    PacketHeader.h
    Util.h
    Util.cc
    
    Auth/AuthCrypt.h
    Auth/AuthCrypt.cc

    Base/Atomic.h
    Base/LockGuard.h
    Base/Runnable.h
    Base/Mutex.h
    Base/Event.h
    Base/Thread.h
    Base/ThreadPool.h
    Base/ThreadPool.cc
    Base/StackTrace.h
    
    Binary/ByteConverter.h
    Binary/ByteBufferException.h
    Binary/ByteBufferException.cc
    Binary/ByteBuffer.h
    Binary/ByteBuffer.cc
    Binary/LocalByteBuffer.h
    Binary/WorldPacket.h
    Binary/WorldPacket.cc
    Binary/WorldPacketDump.h
    Binary/WorldPacketDump.cc
    
    Crypto/BigNumber.h
    Crypto/BigNumber.cc
    Crypto/Sha1.h
    Crypto/Sha1.cc
    Crypto/Hmac.h
    Crypto/Hmac.cc
    
    DB/DB.h
    DB/Callback.h
    DB/Field.h
    DB/Field.cc
    DB/QueryResult.h
    DB/QueryResult.cc
    DB/SqlPreparedStatement.h
    DB/SqlPreparedStatement.cc
    DB/SqlConnection.h
    DB/SqlConnection.cc
    DB/SqlOperation.h
    DB/SqlOperation.cc
    DB/SqlDelayThread.h
    DB/SqlDelayThread.cc
    DB/Database.h
    DB/DatabaseImpl.h
    DB/Database.cc
    DB/MySQL/MySQLDatabase.h
    DB/MySQL/MySQLDatabase.cc
    DB/MySQL/MySQLQueryResult.h
    DB/MySQL/MySQLQueryResult.cc
    DB/MySQL/MysqlSqlConnection.h
    DB/MySQL/MysqlSqlConnection.cc
    DB/SQLStorage.h
    DB/SQLStorage.cc
    DB/SQLStorageImpl.h
    
    DBC/DBCFileLoader.h
    DBC/DBCFileLoader.cc
    DBC/DBCStore.h
    
    Log/Log.h
    Log/Log.cc

    Util/Error.h
    Util/String.h
    Util/String.cc
    Util/ByteConverter.h
    Util/Random.h
    Util/Random.cc
    Util/Time.h
    Util/Option.h
    Util/Option.cc
    Util/OptionSet.h
    Util/OptionSet.cc
    Util/Application.h
    Util/Application.cc
    Util/SubSystem.h
    Util/IniFile.h
    Util/IniFile.cc
    Util/LockedQueue.h
    Util/ProgressBar.h
    Util/ProgressBar.cc
    
    Net/ServerSocket.h
    Net/ServerSocket.cc
    Net/Socket.h
    Net/Socket.cc
    Net/SocketEventHandlerFactory.h
    Net/SocketEventHandler.h
    Net/TcpServer.h
    Net/TcpServer.cc
)

if (WIN32)
set(Shared_SRC
    Base/Mutex_WIN32.h
    Base/Event_WIN32.h
    Base/Thread_WIN32.h
    Base/Thread_WIN32.cc
    Base/StackTrace_WIN32.h
    Base/StackTrace_WIN32.cc
    
    DB/Field_WIN32.cc
    DB/MySQL/MysqlSqlConnection_WIN32.cc
    
    Log/Log_WIN32.cc
    
    Util/Error_WIN32.cc
    Util/String_WIN32.cc
    Util/Time_WIN32.cc
    
    Net/Socket_WIN32.cc
${Shared_SRC})
endif()

add_library(Shared ${Shared_SRC})